package dev.projectnightfall.network;

import dev.projectnightfall.thread.IThread;

import java.io.OutputStream;

/**
 * Class to handle the OutputStream to the socket connected to the server.
 */
public class OutputHandler implements IThread {

    /**
     * Main needed variables.
     */
    protected OutputStream output;
    private boolean loopThread;

    /**
     * Constructor which assigns the variables and initialises the handler.
     *
     * @param outputStream OutputStream to the socket.
     */
    public OutputHandler(OutputStream outputStream) {
        output = outputStream;
        loopThread = true;
    }

    /**
     * Halts the thread.
     */
    @Override
    public void stopThread() {
        loopThread = false;
    }

    /**
     * Method called when .start() is called.
     */
    @Override
    public void run() {
        do {
            //will handle on next commit
        } while (loopThread);
    }
}
